#!/usr/bin/python
# -*- encoding: utf-8 -*-
'''
@File    :   7.py
@Time    :   2020/03/15 23:28:47
@Author  :   Malygos_l 
@Version :   1.0
@Contact :   751756061@qq.com
@WebSite :   www.gitee.com/malygos_l

随机生成20个学生的成绩; 判断这20个学生成绩的等级; 用函数来实现;  
    A---成绩>=90;  
    B-->成绩在 [80,90)
    C-->成绩在 [70,80)
    D-->成绩<70
''' 
# Start typing your code from here

from random import randint
scores = [randint(60,100) for _ in range(20)]

def level(score):
    if score < 70:
        return "D"
    elif score < 80:
        return "C"
    elif score < 90:
        return "B"
    else:
        return "A"

for score in scores:
    print("该学生成绩为:{0}\t\t等级为:{1}".format(score,level(score)))